import Vue from 'vue'
import App from './App'
import base from './js/base.js';
import weixin from './js/app.js';
import share from './js/share.js'
Vue.config.productionTip = false;
Vue.mixin(share);
uni.getProvider({
	service:'payment',
	success:function(res){
		base.session.set('pay_provider',res.provider[0]);
	}
});
base.request({
	url:base.urltext('/itorder/info_port/weixin_share'),
	success:function(res){
		if(res.data.success>0)
		{
			base.session.set('weixin_share',res.data.list);
		}
	}
	
});
weixin.initUser(function(){
	if(!weixin.g.user_openid)
	{
		uni.showToast({
		    title: '无法获取授权', icon: 'none', duration: 3000
		});
		return ;
	}
	uni.getUserInfo({lang:'cn',success(res) {
		var s=JSON.parse(res.rawData);
		s.openid=weixin.g.user_openid,
		s.insert_member=1;
		
		base.request({
			url:'https://www.fzftjc.com/com.php?op=weixin_min/member',
			data:s,
			//header:{ 'content-type': 'application/x-www-form-urlencoded' },
			success:function(res){
				if(res.data.success>0)
				{
					base.session.set('weixin_min_number',res.data,60*60*5);
					// uni.showToast({
					//     title: '登录授权成功', icon: 'success', duration: 3000
					// });						
				}else{
					uni.showToast({
					    title: '无法获取授权', icon: 'none', duration: 3000
					});
					return ;
				}
			}
		})
	},fail() {
		uni.showToast({
		    title: '无法获取授权', icon: 'none', duration: 3000
		});
		return ;
	}});	
})
App.mpType = 'app'
const app = new Vue({
    ...App
})
app.$mount()
